<div class="content content_padding">
  <h1>产品编辑</h1>
  
  <% form_for([:admin , @product] , :html => {:class => :form , :multipart => true}) do |f| %>
    <%= f.error_messages %>
            
    <table class='table'>
      <tr>
        <td align="right">    <%= Product.human_attribute_name(:name)%> : </td>
        <td>             <%= f.text_field :name %>    </td>
      </tr>
      <tr>
        <td align="right">      <%= Product.human_attribute_name(:serial)%> : </td>
        <td>             <%= f.text_field :serial %> </td>
      </tr>
      <tr>
        <td align="right">           <%= Product.human_attribute_name(:proved_serial)%> : </td>
        <td>                <%= f.text_field :proved_serial %> </td>
      </tr>
      <tr>
        <td align="right">  <%= Product.human_attribute_name(:sort_id)%>  :</td>
        <td>  <%= f.select :sort_id ,Sort.all.map{|s| [s.name,s.id]}  %> </td>
      </tr>
      <tr>
        <td align="right">  <%= Product.human_attribute_name(:color_id)%>  :</td>
        <td>   <%= f.select :color_id , Color.all.map{|c| [c.name ,c.id]} %></td>
      </tr>
      <tr>
        <td align="right">  <%= Product.human_attribute_name(:state)%>  :</td>
        <td>   <%= f.select :state , Product::STATE.map { |k,v|[v ,k]  } %></td>
      </tr>
      <tr>
        <td  align="right">  <%= Product.human_attribute_name(:rank)%> :</td>
        <td>    <%= f.select :rank , Product::RANK.map { |k,v|[v ,k]  } %></td>
      </tr>
      <tr>
        <td  align="right">  <%= Product.human_attribute_name(:price)%> :</td>
        <td>   <%= f.text_field :price %></td>
      </tr>
      <tr>
        <td  align="right"> <%= Product.human_attribute_name(:current_price)%> :</td>
        <td>       <%= f.text_field :current_price %></td>
      </tr>
      <tr>
        <td  align="right"><%= Product.human_attribute_name(:introduction)%> :</td>
        <td>        <%= f.text_area :introduction %></td>
      </tr>
    
      <tr>
        <td  align="right">&nbsp;</td>
        <td>           <%= f.submit "修改" ,:class => :button %>   |
  <%= link_to '显示', admin_product_path(@product) %> |
  <%= link_to '返回', admin_products_path %>    </td>
      </tr>
    </table>
  <% end %>

</div>